#include <STC89C5xRC.H>
#include "delay.h"

unsigned char key()
{
	unsigned char keynumber=0;
	if(P31 == 0){Delayms(20);while(P31==0);Delayms(20);keynumber = 1;}
	if(P30 == 0){Delayms(20);while(P30==0);Delayms(20);keynumber = 2;}
	if(P32 == 0){Delayms(20);while(P32==0);Delayms(20);keynumber = 3;}
	if(P33 == 0){Delayms(20);while(P33==0);Delayms(20);keynumber = 4;}
	
	return keynumber;


}